<template>
  <div>
    <h3>{{ obj }}</h3>
    <button @click="btnClick">修改obj</button>
    <hr />
    <h3>{{ arr }}</h3>
    <button @click="btnClick2">修改arr</button>
  </div>
</template>
<script>
export default {
  data () {
    return {
      obj: {
        name: '小张'
      },
      arr: [1, 2, 3]
    }
  },
  methods: {
    btnClick () {
      // this.obj.age = 20
      this.$set(this.obj, 'age', 20)
      console.log(this.obj)
    },
    btnClick2 () {
      // this.arr.push(10)
      this.arr[0] = 999
    }
  }
}
</script>
<style></style>
